﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GlobalCoroutine : MonoBehaviour
{
    static GlobalCoroutine s_instance;
    public static GlobalCoroutine Instance
    {
        get
        {
            return s_instance;
        }
    }

    void Awake()
    {
        s_instance = this;
        GameObject.DontDestroyOnLoad(this.gameObject);
    }

    public new Coroutine StartCoroutine(IEnumerator routine)
    {
        return base.StartCoroutine(routine);
    }

    // Use this for initialization
    void Start ()
    {
		
	}
	
	// Update is called once per frame
	void Update ()
    {
		
	}

    public void Release()
    {
        StopAllCoroutines();
        GameObject.Destroy(s_instance.gameObject);
    }
}
